package cn.tedu.content.controller;

import cn.tedu.content.pojo.param.CategoryAddParam;
import cn.tedu.content.service.CategoryService;
import cn.tedu.tmall.common.web.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/categories")
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @RequestMapping("/category/add")
    public JsonResult add(CategoryAddParam categoryAddParam){
     log.debug("开始处理添加分类请求,入参{}",categoryAddParam);
     categoryService.addCategory(categoryAddParam);
     JsonResult jsonResult = new JsonResult();
     jsonResult.setState(200);
     jsonResult.setMessage("ok,保存成功");
     log.debug("处理添加分类请求完成,入参{},出参:{}",categoryAddParam,jsonResult);
        return jsonResult;

    }
}
